package com.wu.client.controller;

import cn.hutool.core.bean.BeanUtil;
import com.wu.client.cache.newData.NewAlbumCache;
import com.wu.client.cache.newData.NewSongCache;
import com.wu.client.constant.ResTypeEnum;
import com.wu.client.service.AlbumService;
import com.wu.client.service.ArtistService;
import com.wu.client.service.MvService;
import com.wu.client.service.PlaylistService;
import com.wu.client.vo.req.album.AlbumReq;
import com.wu.client.vo.req.artist.ArtistReq;
import com.wu.client.vo.res.PageResp;
import com.wu.client.vo.res.album.AlbumBaseResp;
import com.wu.client.vo.res.artist.ArtistBaseResp;
import com.wu.client.vo.res.home.ReleaseData;
import com.wu.client.vo.res.mv.MvBaseResp;
import com.wu.client.vo.res.playlist.PlaylistBaseResp;
import com.wu.common.convertion.result.Result;
import com.wu.common.convertion.result.Results;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Cousin
 * @date 2025/4/4
 * @Description
 */
@RequiredArgsConstructor
@RequestMapping("/recommendation")
@RestController
public class RecommendController {
    private final MvService mvService;
    private final PlaylistService playlistService;
    private final AlbumService albumService;
    private final ArtistService artistService;
    @GetMapping("artist")
    public Result<PageResp<ArtistBaseResp>> getRecommendArtists(@RequestParam(defaultValue = "1") Integer page, @RequestParam Integer limit
            ,@RequestParam(required = false) Long userId
    ) {
        ArtistReq artistReq = new ArtistReq();
        artistReq.setPage(page);
        artistReq.setLimit(limit);
        artistReq.setUserId(userId);
       return Results.success(artistService.getArtists(artistReq));
    }
    @GetMapping("mv")
    public Result<PageResp<MvBaseResp>> getRecommendMvs(@RequestParam(defaultValue = "1") Integer page, @RequestParam Integer limit
            ,@RequestParam(required = false) Long userId) {
        return Results.success(mvService.getMvs(page,limit,userId,null,null,null,null));
    }
    @GetMapping("playlist")
    public Result<PageResp<PlaylistBaseResp>> getRecommendPlaylists(@RequestParam(defaultValue = "1") Integer page, @RequestParam Integer limit
            ,@RequestParam(required = false) Long userId) {
        return Results.success(playlistService.getPlaylists(page,limit,null,userId));
    }
    @GetMapping("album")
    public Result<PageResp<AlbumBaseResp>> getRecommendAlbums(@RequestParam(defaultValue = "1") Integer page, @RequestParam Integer limit
            ,@RequestParam(required = false) Long userId) {
        AlbumReq albumReq = new AlbumReq();
        albumReq.setPage(page);
        albumReq.setLimit(limit);
        albumReq.setUserId(userId);
        return Results.success(albumService.getAlbums(albumReq));
    }



}
